package com.visec.hdy.task;

import java.util.Map;

import com.visec.hdy.config.PCVHandle;
import com.visec.hdy.transmission.ftp.config.FtpModelCV;
import com.visec.hdy.transmission.rmi.RMIFactory;
import com.visec.hdy.transmission.rmi.code.RMIClient;
import com.visec.hdy.transmission.rmi.config.RMIModel;
import com.visec.hdy.transmission.rmi.config.RMIModelCV;

public class SyncServerTask {
	public static void start(Map<String, String> m,String type) {
		PCVHandle pcv = new PCVHandle(new FtpModelCV(), new RMIModelCV());
		pcv.conversion(m);
		RMIModel rmi = pcv.getTarget(RMIModel.class);
		String ftpId = m.get("-ftpId");
		if (ftpId == null) {
			System.out.println("no ftpId,please set ftpId byt -ftpId!");
			return;
		}

		RMIClient createClient = RMIFactory.getInstance().createClient(rmi);

		ServerTaskImp sti = new ServerTaskImp(m,type);

		createClient.bindInNull(rmi.getRmiUrl(), sti);

		createClient.unicastInNull(rmi.getRmiUrl());

	}
}
